<!DOCTYPE html>
<html>
<head>
    <title>LUI组件库</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <meta name="keywords" content="LUI，轻量级移动端UI组件库"/>
    <meta name="description" content="LUI，基于html,css,js原生能力驱动，轻量级移动端UI组件库。LUI不是框架，她只是为你的应用提供基础的UI组合以及一些常用方法，架构层面随你自行组织" />
    <link rel="icon" href="images/icon/lui.png">
   
    <link rel="stylesheet" type="text/css" href="css/lui.css" />

  <script type="text/javascript" src="js/demo.js"></script>
</head>
<body>
     <div class="ui_page_wrap">
        <header class="ui_page_hd"><a href="javascript:goBack();" class="ui_back"></a>模态框</header>
        <div class="ui_page_bd">
            <p class="ui_con_block">
                alert，confirm，prompt。
            </p>
            <div class="nav_tab_wrap">
                <!-- /// [htmldemo] -->
                <nav class="ui_capsule_tab ui_flex" id="js_tabs">
                    <a href="javascript:;" class="ui_flex_item on" id="js_alert">alert</a>
                    <a href="javascript:;" class="ui_flex_item" id="js_confirm">confirm</a>
                    <a href="javascript:;" class="ui_flex_item" id="js_prompt">带输入框</a>
                </nav>
                <!-- /// [htmldemo] -->
            </div>
        </div>
    </div>

<script type="text/javascript" src="js/lui.js"></script>
<script type="text/javascript">
    ///[jsdemo]
    lui.selector('#js_tabs').onclick = function(e){
        var _id = e.target.id;
        if (_id == 'js_alert') {
             lui.showModal({
                content:'alert',
                showCancel:false,
                confirm:function(){
                   lui.showModal({
                        content:'呵呵',
                        confirm:function(){
                            console.log('confirm');
                        }
                    });
                }
            });
        }else if (_id == 'js_confirm') {
             lui.showModal({
                content:'confirm',
                showCancel:true,
                cancel:function(){
                   console.log('cancel');
                },
                confirm:function(){
                    console.log('confirm');
                }
            });
        }else if(_id == 'js_prompt'){
            var val;
            lui.showModal({
                content:'<input type="text" placeholder="请输入数字" class="ui_popup_ipt" id="ipt"/>',
                beforeClose:function(btn,done){
                    val = lui.selector('#ipt').value;
                    if (!isNaN(val)) {
                      done()
                    }else{
                      lui.selector('#ipt').value = ''
                    }
                },
                confirm:function(){                    
                    console.log('confirm',val);
                }
            });
        }
    };
    ///[jsdemo]
    
</script>
</body>
</html>